<!--
 * @description: 
 * @Date: 2023-02-15 15:07:27
 * @example: 
 * @params: 
-->
<template>
  <div class="Container">
    <div class="UserInfo">
      <!-- <div class="u_left">
        <div class="u_avatar">
          <el-avatar :size="80" :src="user.$state.Userinfo.avatar" />
        </div>
        <div class="u_message">
          <p class="u_hello">早安,今天又是充满活力的一天!</p>
          <p class="u_weather">
            <iframe
              width="300"
              height="25"
              frameborder="0"
              scrolling="no"
              hspace="0"
              src="https://i.tianqi.com/?c=code&a=getcode&id=10&py=shenzhen&icon=1"
            ></iframe>
          </p>
        </div>
      </div> -->
      <div class="workOne bt" @click="handle1()">
        <img src="../assets/bt.png" alt="" />
      </div>
      <div class="workOne gitee" @click="handle2">
        <img src="../assets/gitee.png" alt="" />
      </div>
      <div class="workOne jenkins" @click="handle3">
        <img src="../assets/jenkins.jpeg" alt="" />
      </div>
    </div>
    <!-- <el-button type="primary" round @click="dialogVisible = true"
      >Add Location</el-button
    > -->
    <!-- MapChooiseLocation -->
    <div class="MapContainer">
      <el-dialog v-model="dialogVisible" :show-close="false" width="1000px">
        <template #header="{ close, titleId, titleClass }">
          <div class="my-header">
            <el-button type="primary" @click="close">
              <el-icon class="el-icon--left"><Back /></el-icon>
              return
            </el-button>
            <h4 :id="titleId" class="titleClass">{{ localtionInfo }}</h4>
            <el-button type="primary" @click="close">
              <el-icon class="el-icon--left"><Select /></el-icon>
              confirm
            </el-button>
          </div>
        </template>

        <Mapbox v-if="dialogVisible" @update-location="handleGetLocation" />
      </el-dialog>
    </div>
    <el-button type="primary" @click="handleToggletheme('green')">
              <el-icon class="el-icon--left"><Select /></el-icon>
              Change Theme
    </el-button>
    <!-- <ledClock/> -->
    <div class="sketchfab-embed-wrapper"> 
      <iframe id="landing-model" title="A 3D model of a shoe" class="hero__iframe" width="auto" height="auto" src="https://sketchfab.com/models/99bfe75ebd734fa3832a63e02e2cacf7/embed?annotations_visible=0&amp;autospin=-0.1&amp;autostart=1&amp;camera=0&amp;double_click=0&amp;internal=1&amp;max_texture_size=1024&amp;orbit_constraint_pan=1&amp;orbit_constraint_zoom_in=40&amp;orbit_constraint_zoom_out=60&amp;preload=1&amp;scrollwheel=0&amp;sound_enable=0&amp;transparent=1&amp;ui_animations=0&amp;ui_annotations=0&amp;ui_ar=1&amp;ui_ar_help=0&amp;ui_color=white&amp;ui_fadeout=0&amp;ui_fullscreen=1&amp;ui_help=0&amp;ui_infos=0&amp;ui_inspector=0&amp;ui_settings=0&amp;ui_stop=0&amp;ui_theatre=0&amp;ui_theme=dark&amp;ui_vr=0&amp;ui_watermark=0" frameborder="0" allow="autoplay; fullscreen; xr-spatial-tracking" allowfullscreen="" mozallowfullscreen="true" webkitallowfullscreen="true" xr-spatial-tracking="true" execution-while-out-of-viewport="true" execution-while-not-rendered="true" web-share="true"></iframe>
   </div>
  </div>
</template>
<script setup lang="ts">
// import ImageUpload from "@/components/ImageUpload.vue";
// 为了从 store 中提取属性时保持其响应性，你需要使用 storeToRefs()。它将为每一个响应式属性创建引用。
import ledClock from '@/components/LedClock.vue'
import { storeToRefs } from "pinia";
import { ref } from "vue";

/** 具名导入 */
import useMainStore from "@/stores/user";
import Mapbox from "@/components/Mapbox.vue";
const localtionInfo = ref();
const dialogVisible = ref<Boolean>(false);
const user = useMainStore();
console.log("user", user);
console.log("THE DATA FROM PINIA :", user.Userinfo);

/* 解构 */
// const { Userinfo } = storeToRefs(user)
// console.log("结构回来的数据",Userinfo.value)

// /**  修改 */
// Userinfo.value.token = "EYES34728346923479137491724816389461"

// console.log("修改后THE DATA FROM PINIA :", user.Userinfo)
/** 切换主题 */
const handleToggletheme = (color) => {
  document.documentElement.style.setProperty("--theme-bg-color",color)
}
const handle1 = () => {
  window.open("https://47.115.225.183:25005/site");
};
const handle2 = () => {
  window.open("https://gitee.com/zhang-lanxxx");
};
const handle3 = () => {
  window.open("http://47.115.225.183:8080/");
};
/** mapbox */

const handleGetLocation = (location) => {
  console.log("位置信息", location);
  const { address } = location;
  localtionInfo.value = `${address}`;
};
</script>
<style lang="less" scoped>
.my-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.Container {
  //   position: absolute;
  // width: 500px;
  // height: 100%;
  background-color: var(--theme-bg-color);
  .UserInfo {
    display: flex;
    width: 100wh;
    box-shadow: 0 2px 5px 0 rgb(0 0 0 / 10%);
    justify-content: space-evenly;

    // background-color: #f5f7f9;
    .u_left {
      display: flex;
      align-items: center;
      width: 40%;
      background-color: #f5f7f9;
      .u_message {
        margin-left: 20px;
        .u_hello {
          font-size: 20px;
          font-weight: bold;
        }
        .u_weather {
          margin-left: -30px;
        }
      }
    }
    .workOne {
      text-align: center;
      line-height: 130px;
      width: 40%;
      height: 130px;
      margin-right: 20px;
      padding: 20px;
      background-color: #f5f7f9;
      cursor: pointer;
      img {
        object-fit: cover;
        width: 100%;
        height: 100%;
      }
    }
    // .jenkins {

    // }
  }
}

</style>
<style lang="less">
.MapContainer {
  .el-dialog {
    border-radius: 20px;
    .titleClass {
      color: white;
    }
    background-color: rgba(20, 19, 22, 0.8);
    .el-dialog__header {
      padding: 5px 10px 5px 10px !important;
    }
    .el-dialog__body {
      padding-top: 0 !important;
      height: 600px !important;
      // padding: 20px 10px 20px 20px !important;
    }
  }
}

</style>
